using UnityEngine;
using System.Collections;

public class SpritesAlavanca : MonoBehaviour 
{
	double cont;
	int cont2 = 5;
	public Material[] sprites;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	 	renderer.material = sprites[cont2];
		
		
	}
	
	void OnTriggerStay(Collider other)
	{
		if(other.CompareTag("Personagem")&& Input.GetKey("space"))
		{
			cont++;
			
			
			if(cont >= 3)
			{
				cont = 0;
				cont2 --;
			}
			
			if(cont2 <= 0)
			{
				cont2 = 0;
			}
		}
		
	}
}
